import http from "./http";
import qs from "qs";

// 角色列表
export const listRole = (params) => {
  return http.get("/manager/role/listRole", params)
}
// 子账号列表
export const page = (params) => {
  return http.get("/manager/subAccount/page", params)
}
// 通过角色id获取子账号
export const findSubByRoleId = (params) => {
  return http.get("/manager/sunAccount/findSubByRoleId", params)
}
// 修改子账号状态
export const updateStatus = (params) => {
  return http.post("/manager/subAccount/updateStatus", qs.stringify(params))
}
// 删除子账号
export const deleteById = (params) => {
  return http.post("/manager/subAccount/deleteById", qs.stringify(params))
}
// 新增子账号
export const add = (params) => {
  return http.get("/manager/subAccount/add", params)
}
// 修改子账号
export const update = (params) => {
  return http.post("/manager/subAccount/update", params)
}
// 子账号获取详情
export const getInfoById = (params) => {
  return http.get("/manager/subAccount/getInfoById", params)
}
// 修改角色，以及角色关联权限信息
export const updateRoleAndPermissions = (params) => {
  return http.post("/manager/role/updateRoleAndPermissions", params)
}
// 查询相应登录站点的全部权限列表
export const getPermissionList = (params) => {
  return http.get("/manager/role/getPermissionList", params)
}
// 根据角色id查询所有权限id列表
export const findByRoleId = (params) => {
  return http.get("/manager/role/findByRoleId", params)
}
// 删除角色
export const delRole = (params) => {
  return http.post("/manager/role/delRole", qs.stringify(params))
}
// 新增角色和权限关系
export const addRoleAndPermissions = (params) => {
  return http.post("/manager/role/addRoleAndPermissions", params)
}
// eslint-disable-next-line import/no-anonymous-default-export
export default {
  updateRoleAndPermissions,
  delRole,
  addRoleAndPermissions,
  listRole,
  getPermissionList,
  findByRoleId,
  
  update,
  updateStatus,
  deleteById,
  page,
  getInfoById,
  add,
}